package com.hbk.codemaker;

import java.awt.Color;
import java.awt.Dimension;
import java.awt.FlowLayout;
import java.awt.event.ComponentEvent;
import java.awt.event.ComponentListener;
import java.awt.event.ContainerEvent;
import java.awt.event.ContainerListener;

import javax.swing.JFrame;
import javax.swing.JPanel;

public class TestFrame extends JFrame{
	
	public TestFrame() {
		setTitle("CodeMaker 1.1");
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		setSize(1024, 600);
		
		JPanel contentPanel=new JPanel();
		contentPanel.setBackground(Color.WHITE);
		contentPanel.setLayout(new FlowLayout(FlowLayout.LEFT, 0, 10));
		
		JPanel p1=new JPanel();
		p1.setBackground(Color.BLUE);
		p1.setPreferredSize(new Dimension(getWidth(), 30));
		
		JPanel p2=new JPanel();
		p2.setBackground(Color.gray);
		p2.setPreferredSize(new Dimension(getWidth(), 30));
		
		contentPanel.add(p1);
		contentPanel.add(p2);
		
		getContentPane().add(contentPanel);
		setVisible(true);
	
		addComponentListener(new ComponentListener() {
			
			@Override
			public void componentShown(ComponentEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void componentResized(ComponentEvent e) {
				p1.setSize(new Dimension(getWidth(), 30));
				p1.repaint();
				p2.setSize(new Dimension(getWidth(), 30));
				p2.repaint();
			}
			
			@Override
			public void componentMoved(ComponentEvent e) {
				// TODO Auto-generated method stub
				
			}
			
			@Override
			public void componentHidden(ComponentEvent e) {
				// TODO Auto-generated method stub
				
			}
		});
	}
	
	
	
	public static void main(String[] args) throws Exception {
		new MainFrame();
	}

}
